/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.acme.server;

import java.io.Serializable;

/**
 *
 * @author iiping
 */
@SuppressWarnings("serial")
public final class TOServer implements Serializable {
  private String IPAddress;
  private String authCode;

  
  public TOServer(String IPAddress, String accessCode){
    this.IPAddress = IPAddress;
    setAuthCode(accessCode);
  }
  
  public TOServer(String IPAddress){
	  this.IPAddress = IPAddress;
  }


  /**
   * @return the IPAddress
   */
  public String getIPAddress() {
    return IPAddress;
  }

  /**
   * @param IPAddress the IPAddress to set
   */
  public void setIPAddress(String IPAddress) {
    this.IPAddress = IPAddress;
  }

  /**
   * @return the accessCode
   */
  public String getAuthCode() {
    return authCode;
  }

  /**
   * @param accessCode the accessCode to set
   */
  public void setAuthCode(String accessCode) {
	  //this.accessCode = Hexer.encodeMD5HexStr(accessCode);
	  this.authCode = accessCode;
  }
  
  protected void setAuthCodeNoEnc(String accessCode){
	  this.authCode = accessCode;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final TOServer other = (TOServer) obj;
    if ((this.IPAddress == null) ? (other.IPAddress != null) : !this.IPAddress.equals(other.IPAddress)) {
      return false;
    }
    if ((this.authCode == null) ? (other.authCode != null) : !this.authCode.equals(other.authCode)) {
      return false;
    }
    return true;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash = 89 * hash + (this.IPAddress != null ? this.IPAddress.hashCode() : 0);
    hash = 89 * hash + (this.authCode != null ? this.authCode.hashCode() : 0);
    return hash;
  }

}
